home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Business Master (3rd Edition)
/
The Business Master (3rd Edition).iso
/
files
/
comphelp
/
begin6pk
/
chapt3
< prev
next >
Wrap
Text File
|
1992-03-03
|
10KB
|
327 lines
CHAPTER 3
COLOR COMBINATIONS
In This Chapter You Will Learn:
To Write 64 color combinations
Experiment with 1 and 2-letter color codes
Create A Color Menu
WRITING YOUR OWN COLOR COMBINATIONS
There are 8 colors that you will be using for the
foreground (for letters) and eight for the background.
This gives you 64 combinations from which to select your
favorite colors.
One approach to writing these codes is to use a simple
formula for a set of 8 background colors and a set of 8
foreground (letters). This is easily done by using the first
letter of each color: for example, R for red letters, and
RB for red background. This code will also serve as the
name of the Batch file.
A SPEED COURSE IN INSTANT COLOR
The Batch Files that you will be writing have been
designed by the Author to change foreground or background
color individually or together.
The Batch Files that you write will contain the commands
Echo Off and Clear Screen (Cls). Other information about the
Batch File is described below.
▀ The Echo off command will prevent the codes from
appearing on the screen.
▀ The Clear command will then clear the Echo Off
command from the screen.
▀ When you enter a Letter command on the keyboard and
press Enter, the Prompt and text will appear in that color.
▀ When you enter a Background command, the screen
color will change.
▀ When you enter a letter (Y) and a background color
(BB) the screen will show both color changes
simultaneously.
▀ Each Batch File will contain a "Variable Parameter
<%1>". This will make the Batch File accept another
Batch File. This is how you can have the two colors
change at the same time.
▀ The Directory command "DIR" will be included each Batch
File. Since this is the last command in each Bat file it will
provide text material to view with the color changes.
Note the second item in each Batch file uses the variable %1.
This is where the second Batch file is activated
(executes).
-9-
For example, if you want yellow letters and blue background, the
yellow letters execute first, then the blue background executes
second from the variable %1.
By using a variable you can substitute any color for %1. In
the case above you could replace the blue background with any
of the eight colors.
The last item in each Bat file is the Directory command "DIR.
This means whichever Batch file you use the program
will always end with a display on the screen of the files
in the directory.
PUTTING COLOR CODES INTO A MENU
Another way to check color is to put the list of color codes
into a 2-letter Menu. Each time you make a color selection,
you can return to the Menu by entering 2L. This will give you
some color to look at while making your next selection.
HOW TO WRITE THE 2L MENU APPEARS BELOW.
The Menu is Written Like This:
Type next to the A> prompt the following, like this:
Copy Con 2L.Bat
Prompt $p$g
Echo off
Cls
Echo:====== 1 and 2-Letter Color Codes ======
Echo:
Echo: Select 1 color from either column, or 2 colors,
Echo: 1 for Letters and 1 for Background
Echo: Then Press Enter Key
Echo:
Echo: R...Red letters RB... Red background
Echo: G...Green letters GB...Green background
Echo: Y...Yellow letters YB..Yellow background
Echo:
Echo: B...Blue letters BB...Blue background
Echo: M...Magenta letters MB.Magenta background
Echo: CY..Cyan letters CB...Cyan background
Echo:
Echo: W...White letters WB...White background
Echo: BLK..Black letters BLB..Black background
Echo:============================
Press F6 key, then press Enter key to finish Batch file.
---------
You have completed the 2L Menu Bat File.
It will be used in all the color Bat files. When a color
appears on the screen it will always display the 2L Menu.
COLOR CODES
The next lessons use many of the DOS commands that you
have learned thus far. The Batch files contain a good
variety of color codes, parameters, and DOS
commands. You will enjoy how fast these Speed keys operate.
-10-
WRITING THE COLOR CODE BAT FILES
We'll Start With the Background Colors.
Type the following next to the A> Prompt,
Like this: <Press Enter Key after each line.>
Copy Con BLB.Bat (Black background)*
Prompt $e[40m $p$g
%1
Echo off
Cls
2L.Bat
Press F6 key, then press Enter key.
---------------
Copy Con RB.Bat (Red background)
Prompt $e[41m $p$g
%1
Echo off
Cls
2L.Bat
Press F6 key, then press Enter key.
----------------
Copy Con GB.Bat (Green background)
Prompt $e[42m $p$g
%1
Echo off
Cls
2L.Bat
Press F6 key, then press Enter key.
--------------
Copy Con YB.Bat (Yellow background)
Prompt $e[43m $p$g
%1
Echo off
Cls
2L.Bat
Press F6 key, then press Enter key.
--------------
Copy Con BB.Bat (Blue background)
Prompt $e[44m $p$g
%1
Echo off
Cls
2L.Bat
Press F6 key, then presss Enter key.
---------------
Copy Con MB.Bat (Magenta background)
Prompt $e[45m $p$g
%1
Echo off
Cls
2L.Bat
Press F6 key, then press Enter key.
----------------
-11-
Copy Con CB.Bat (Cyan background>
Prompt $e[46m $p$g
%1
Echo off
Cls
2L.Bat
Press F6 key, then press Enter key.
---------------
Copy Con WB.Bat (White background)
Prompt $e[47m $p$g
%1
Echo off
Cls
2L.Bat
Press F6 key, the press Enter key.
---------------
In The Next Group Are The Codes For The Letters (Foreground).
Copy Con BLK.BAT (Black letters)
Prompt $e[30m $p$g
%1
Echo off
Cls
2L.Bat
Press F6 key, the press Enter key.
--------------
Copy Con R.Bat (Red letters)
Prompt $e[1;31m $p$g
%1
Echo off
Cls
2L.Bat
Press F6 key, then press Enter key.
--------------
Copy Con G.Bat (Green letters)
Prompt $e[1;32m $p$g
%1
Echo off
Cls
2L.Bat
Press F6 key, then press Enter key.
---------------
Copy Con Y.Bat (Yellow letters)
Prompt $e[1;33m $p$g
%1
Echo off
Cls
2L.Bat
Press F6 key, then press Enter key.
----------------
-12-
Copy Con B.Bat (Blue letters)
Prompt $e[1;34m $p$g
%1
Echo off
Cls
2L.Bat
Press F6 key, then press Enter key.
----------------
Copy Con M.Bat (Magenta letters)
Prompt $e[1;35m $p$g
%1
Echo off
Cls
2L.Bat
Press F6 key, then press Enter key.
----------------
Copy Con CY.Bat (Cyan letters)
Prompt $e[1;36m $p$g
%1
Echo off
Cls
2L.Bat
Press F6 key, then press Enter key.
--------------
Copy Con W.Bat (White letters)
Prompt $e[1;37m $p$g
%1
Echo off
Cls
2L.Bat
Press F6 key, then press Enter key.
--------------
This ends the writing of Batch Files for the 1 and 2 letter
color-codes.
Go to Chapter 4 ...Testing Colors.
-13-